cmake_minimum_required(VERSION 3.10)

project(
    mock-p0f
    VERSION 0.0.1
    LANGUAGES C)

include(ExternalProject)

externalproject_add(
    cimplog
    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/third-party/cimplog
    GIT_REPOSITORY git@gitee.com:third_party_2/cimplog.git
    GIT_TAG "1.0.1"
    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR} -DBUILD_TESTING=OFF -DLEVEL_DEFAULT=2)
add_library(libcimplog STATIC IMPORTED)
set_target_properties(libcimplog PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lib/libcimplog.a")
add_dependencies(libcimplog cimplog)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

aux_source_directory(src SRC_LIST)

add_executable(${PROJECT_NAME} ${SRC_LIST})
target_include_directories(${PROJECT_NAME} PUBLIC include ${CMAKE_CURRENT_BINARY_DIR}/include)
target_link_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/lib)
target_link_libraries(${PROJECT_NAME} libcimplog)
